function [ mpc ] = carMPCdiff(sys, x, u, k, param )
[t,Y]=ode45(@(t,y)carFceSol(t,y,u,param),0:sys.Ts:(sys.Ts*param.Tp),x);
Y(isnan(Y))=0;
ref=param.ref(:,k:k+param.Tp-1)-Y(2:end,:)';
refT=ref';
[m,n]=size(ref);
refCol=ref(1:m*n);
mpc=InitMPC(sys,diag(param.diagQ),diag(param.diagR),diag(param.diagH));
mpc=MPCSampling(mpc,param.Tp,param.Tvz,blockMatrix(sys,param.Tvz,param.Block));
mpc=MPCHardBounds(mpc,createBounds(5,param.Tvz,param.lb-u,param.boundLocation,-1),createBounds(5,param.Tvz,param.ub-u,param.boundLocation,1));
mpc=MPCSoftBounds(mpc,createBounds(6,param.Tp,param.lb_w-x,[],-1),createBounds(6,param.Tp,param.ub_w-x,[],1),selectSoftBounds(length(sys.A),param.Tp,param.kroky,param.promenne));
mpc=addMPCstate(mpc,zeros(size(x)));
mpc=addMPCcontrol(mpc,zeros(size(u)));
mpc=addMPCref(mpc,refCol');
end